<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>弹性有限元方法 | Tom's develop Blog</title><meta name="keywords" content="超弹性物体,有限元方法,FEM"><meta name="author" content="Tom"><meta name="copyright" content="Tom"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="description" content="弹性有限元与超弹性物体模拟方法">
<meta property="og:type" content="article">
<meta property="og:title" content="弹性有限元方法">
<meta property="og:url" content="https://tomsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/index.html">
<meta property="og:site_name" content="Tom&#39;s develop Blog">
<meta property="og:description" content="弹性有限元与超弹性物体模拟方法">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/弹性有限元方法/figure1.jpg">
<meta property="article:published_time" content="2021-09-11T09:05:34.000Z">
<meta property="article:modified_time" content="2021-09-27T08:26:20.221Z">
<meta property="article:author" content="Tom">
<meta property="article:tag" content="超弹性物体">
<meta property="article:tag" content="有限元方法">
<meta property="article:tag" content="FEM">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/弹性有限元方法/figure1.jpg"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/avatar.png"><link rel="canonical" href="https://tomsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="preconnect" href="//zz.bdstatic.com"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: Tom","link":"链接: ","source":"来源: Tom's develop Blog","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  ClickShowText: {"text":"富强,民主,文明,和谐,自由,平等,公正,法治,爱国,敬业,诚信,友善","fontSize":"15px"},
  lightbox: 'mediumZoom',
  Snackbar: undefined,
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-09-27 16:26:20'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = 'true'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }})()</script><meta name="generator" content="Hexo 5.2.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/avator.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">73</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">12</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/弹性有限元方法/figure1.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Tom's develop Blog</a></span><span id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="post-info"><h1 class="post-title">弹性有限元方法</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-09-11T09:05:34.000Z" title="发表于 2021-09-11 17:05:34">2021-09-11</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-09-27T08:26:20.221Z" title="更新于 2021-09-27 16:26:20">2021-09-27</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/OpenSourceSummer2021/">OpenSourceSummer2021</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Computer-Graphics/">Computer Graphics</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Physics-engine/">Physics engine</a></span></div><div class="meta-secondline"> <span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>8分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/#post-comment"><span class="gitalk-comment-count comment-count"></span></a></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="弹性有限元与超弹性物体模拟方法"><a href="#弹性有限元与超弹性物体模拟方法" class="headerlink" title="弹性有限元与超弹性物体模拟方法"></a>弹性有限元与超弹性物体模拟方法</h2><p>&emsp;在引入有限元之前，先简单介绍相关的物理理论。在后面的部分，使用粗体符号如 $\boldsymbol{x}$ 表示向量或矩阵(张量), 未加粗的符号为标量, 如 $x$。</p>
<h3 id="1、形变（Deformation）"><a href="#1、形变（Deformation）" class="headerlink" title="1、形变（Deformation）"></a>1、形变（Deformation）</h3><p>当弹性材料发生形变，其上点$x$会移动到新的位置，我们形变映射(Deformation map) $\boldsymbol \phi$ 表达此关系,它是一个向量到向量的映射。有：</p>
<p>$$\boldsymbol x_{deformed} = \boldsymbol \phi( \boldsymbol x_{rest})$$</p>
<p>为了更好地描述形变，通常使用形变梯度(deformation gradient)来表示这个形变。形变梯度定义为：</p>
<p>$$\boldsymbol F = \frac{\partial \boldsymbol \phi( \boldsymbol x_{rest})}{\partial \boldsymbol x_{rest}} = \frac{\boldsymbol x_{deformed}}{\boldsymbol x_{rest}} \tag{1}$$</p>
<p>这里 $\boldsymbol F$是一个n阶张量，2D问题就是一个二阶张量(2 x 2 矩阵)，3D就是一个三阶张量(3 x 3矩阵)。</p>
<p>$\boldsymbol F$的行列式（通常用$\boldsymbol J$表示）也是非常有用的，因为它的表征无限小体积的变化。它通常表示为:</p>
<p>$$\boldsymbol J = det(\boldsymbol F) \tag{2}$$</p>
<p>$\boldsymbol J$表示在无限小体积（面积）相对原始体积（面积）的比率。例如，在刚性运动（旋转和平移）中这很好理解， $\boldsymbol F$是旋转矩阵且$\boldsymbol J = 1$。请注意，单位矩阵也是旋转矩阵。 $\boldsymbol J &gt; 1$表示体积(面积)增加，$\boldsymbol J &lt; 1$表示体积(面积)减小。</p>
<p>$\boldsymbol J = 0$意味着体积变成0。在真实世界中，这将不会发生。然而，数值上获得这样的$\boldsymbol F$是可能的。在3D中，这表明物质被压缩使其成为一个面或一条线或是一个无体积的点。 $\boldsymbol J &lt; 0$意味着物体被反转。考虑2D中的一个三角形， $\boldsymbol J &lt; 0$意味着某个顶点穿过了它相对的边，然后面积变成了负值。</p>
<h3 id="2、弹性（Elasticity）"><a href="#2、弹性（Elasticity）" class="headerlink" title="2、弹性（Elasticity）"></a>2、弹性（Elasticity）</h3><h4 id="2-1-应变势能（Strain-energy）与应力（stress）"><a href="#2-1-应变势能（Strain-energy）与应力（stress）" class="headerlink" title="2.1 应变势能（Strain energy）与应力（stress）"></a>2.1 应变势能（Strain energy）与应力（stress）</h4><p>&emsp; 对于超弹性材料,其应力与应变关系由一个应变能量密度函数定义:</p>
<p>$$\Psi = \Psi(\boldsymbol{F}) \tag{3}$$</p>
<p>直观地理解：$\Psi $ 是惩罚形变的隐函数。这个势函数与物体抵抗形变所产生的力有关，这个力叫应力(stress)，它是材料内部的一种弹性力。而之前 (1) 定义的形变梯度$\boldsymbol F$也叫做应变（strain）。</p>
<p>知道了势能密度之后，对于一个物体，其总的弹性势能就是：</p>
<p>$$E = \int_{\Omega} \boldsymbol{\Psi(F)} d \boldsymbol{X} \tag{4}$$</p>
<p>因此，物体在任意一点的受力可以通过势能的负梯度来计算：</p>
<p>$$ \boldsymbol {f(x)} = - \frac{\partial E}{\partial \boldsymbol{x}} \tag{5}$$</p>
<p>应力代表无限小体积（面积）的材料成分对其附近施加的内力。为了表示应力，定义了不同的度量来表示：</p>
<ul>
<li><p>First Piola-Kirchhof(PK1)应力  $\boldsymbol {P(F)} = \frac{\partial \boldsymbol{\Psi}( \boldsymbol{F})}{\partial \boldsymbol{F}} $ </p>
</li>
<li><p>Kirchhoff 应力： $\boldsymbol \tau$  </p>
</li>
<li><p>柯西（cauchy）应力:  $\boldsymbol \sigma$  </p>
</li>
</ul>
<p>三种应力都是一个张量，维度与应变 $\boldsymbol F$ 一样。三种应变可以相互转化：<br>$$\boldsymbol \tau =  J\boldsymbol \sigma = \boldsymbol{PF}^{T}, \boldsymbol P = J \boldsymbol {\sigma F}^{-T} \tag{6}$$</p>
<p>&emsp; 图形学模拟里一般常用PK1应力与柯西应力。</p>
<h4 id="2-2-弹性模量（Elastic-moduli）"><a href="#2-2-弹性模量（Elastic-moduli）" class="headerlink" title="2.2 弹性模量（Elastic moduli）"></a>2.2 弹性模量（Elastic moduli）</h4><p>&emsp; 物理模拟中，常常使用各向同性模型，指的沿物体任意一个方向施加形变，沿该方向对抗该形变的力都是一样的。为了描述各向同性物体的弹性，引入弹性模量来度量弹性，有以下几种：</p>
<ul>
<li><p>Young’s modulus $E = \frac{\sigma}{\varepsilon}$  </p>
</li>
<li><p>Bulk modulus $K = - V \frac{dP}{dV}$  </p>
</li>
<li><p>Poisson’s ratio $\nu \in [0 , 0.5]$  </p>
</li>
<li><p>Lam$\acute{e}$’s first parameter $\mu$  </p>
</li>
<li><p>Lam$\acute{e}$’s second parameter $\lambda$  </p>
</li>
</ul>
<p>他们之间也可以相互转化, </p>
<p>$$K = \frac{E}{3(1 - 2\nu)},  \lambda = \frac{E\nu}{(1 + \nu)(1 - 2\nu)},  \mu = \frac{E}{2(1 + \nu)} \tag{7}$$</p>
<p>&emsp; 图形学模拟里一般常常设定 $E$ 与 $\nu$ 的值, 其他值通过这两个算出来。</p>
<h4 id="2-3-超弹性材料模型"><a href="#2-3-超弹性材料模型" class="headerlink" title="2.3 超弹性材料模型"></a>2.3 超弹性材料模型</h4><p>&emsp; 图形学里常常使用一个确定的函数来描述弹性势能与应变间的关系，进而将应变与应力联系起来。一般常用的线性弹性模型有：</p>
<p>（1）Neo-Hookean模型</p>
<p>$$\boldsymbol{\Psi}( \boldsymbol{F}) = \frac{\mu}{2}\sum_{i}[(\boldsymbol{FF^{T}})_{ii}-1]-\mu log(J) + \frac{\lambda}{2}log^{2}(J) \tag{8}$$</p>
<p>$$\boldsymbol{P}( \boldsymbol{F}) = \frac{\partial \Psi}{\partial \boldsymbol F} = \mu(\boldsymbol {F-F^{T}}) + \lambda log(J) \boldsymbol{F^{-T}} \tag{9}$$</p>
<p>（2） (Fixed) Corotated模型</p>
<p>$$\boldsymbol{\Psi}( \boldsymbol{F}) = \mu \sum_{i}(\boldsymbol{\sigma_{i}-1})^{2}- \frac{\lambda}{2}(J - 1)^{2} \tag{10}$$</p>
<p>$$\boldsymbol{P}( \boldsymbol{F}) = \frac{\partial \Psi}{\partial \boldsymbol F} = 2\mu(\boldsymbol {F-R}) + \lambda (J - 1)J\boldsymbol{F^{-T}} \tag{11}$$</p>
<p>&emsp;公式（10）里的 $\sigma_{i}$ 是应变 $\boldsymbol F$的奇异值。公式（11)里的 $R$ 是 $F$ 进行极分解 $\boldsymbol {F = RS}$ 后得到的。</p>
<h3 id="3、线性有限元方法（Linear-finite-element-method"><a href="#3、线性有限元方法（Linear-finite-element-method" class="headerlink" title="3、线性有限元方法（Linear finite element method)"></a>3、线性有限元方法（Linear finite element method)</h3><p>&emsp; 有限元方法是一种 Galerkin 离散化方法，使用连续偏微分方程的弱形式来构建离散方程。直观地讲，就是讲一个连续的物体或表面划分为一个个微元，也就是element,在一个个微元上根据物理性质来构建方程逼近连续的求解结果。</p>
<p>&emsp;在物理模拟中，常常使用三角形（2D）或四面体（3D）来作为相应的有限元element。</p>
<p>&emsp;引入有限元之后，公式（4）可以重写成：</p>
<p>$$E = \sum_{e}E^{e}(x) = \sum_{e}  \int_{\Omega_{e}} \boldsymbol{\Psi(F)} d \boldsymbol{X} = \sum_{e} V_{e} \boldsymbol{\Psi(F_{e})} \tag{12}$$</p>
<p>&emsp;相应地，每个微元上的点受力可以写成：</p>
<p>$$ \boldsymbol {f(x)} = - \frac{\partial E(x)}{\partial \boldsymbol{x}}<br>= - \sum_{e} \frac{\partial E^{e}(x)}{\partial \boldsymbol{x}}<br>= - \sum_{e} V_{e}\frac{\partial \boldsymbol\Psi(\boldsymbol F_{e})}{\partial {\boldsymbol F_{e}}} \frac{\partial \boldsymbol F_{e}}{\partial {\boldsymbol x}}<br>= - \sum_{e} V_{e} \boldsymbol P(\boldsymbol F_{e}) \frac{\partial \boldsymbol F_{e}}{\partial {\boldsymbol x}} \tag{13}$$</p>
<h4 id="3-1-四面体有限元与三角形有限元"><a href="#3-1-四面体有限元与三角形有限元" class="headerlink" title="3.1 四面体有限元与三角形有限元"></a>3.1 四面体有限元与三角形有限元</h4><p>&emsp;线性有限元（用于弹性）假设形变映射是仿射的，因此变形梯度 $\boldsymbol F$ 在单个element内是常量。</p>
<p><img src= "/img/loading.gif" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/figure2.jpg" alt="tetrahedron">  </p>
<p>&emsp;对于四面体微元，有</p>
<div align=center>

<p><img src= "/img/loading.gif" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/figure3.jpg" alt="tetrahedron">  </p>
</div>

<p>表示成</p>
<p>$$\boldsymbol D_{S}= \boldsymbol F \boldsymbol D_{m} \tag{14}$$ </p>
<p>其中 $\boldsymbol D_{s} = \left[<br>\begin{matrix}<br>\boldsymbol x_{1} - \boldsymbol x_{4} &amp; \boldsymbol x_{2} - \boldsymbol x_{4} &amp; \boldsymbol x_{3} - \boldsymbol x_{4}<br>\end{matrix}<br>\right]$ 被称为deformed shape矩阵,  $\boldsymbol D_{m} = \left[<br>\begin{matrix}<br>\boldsymbol X_{1} - \boldsymbol X_{4} &amp; \boldsymbol X_{2} - \boldsymbol X_{4} &amp; \boldsymbol X_{3} - \boldsymbol X_{4}<br>\end{matrix}<br>\right]$ 被称为reference shape矩阵。它是一个常数矩阵，只与初始状态有关。</p>
<p>四面体的体积可以计算为：</p>
<p>$$V_{e} = \frac{1}{6}|det(\boldsymbol D_{m})| \tag{15}$$</p>
<p>由$\boldsymbol D_{m}$ 可逆， 可以求出形变梯度 $\boldsymbol F$ :</p>
<p>$$\boldsymbol F = \boldsymbol D_{s} \boldsymbol D_{m}^{-1} \tag{16}$$ </p>
<p>为了计算四面体每个顶点的受力，需要计算 $\frac{\partial \boldsymbol F_{e}}{\partial {\boldsymbol x}}$， 这里直接给出受力的计算结果。<a target="_blank" rel="noopener" href="http://www.femdefo.org/">具体推导</a>看这里。</p>
<p>$$\boldsymbol H = [\boldsymbol f_{i}, \boldsymbol f_{2}, \boldsymbol f_{3}] = -V_{e} \boldsymbol P(\boldsymbol F) \boldsymbol D_{m}^{-T} \tag{17}$$ </p>
<p>这里的 $\boldsymbol P(\boldsymbol F)$ 可以直接使用公式（9）或（11）的结果。$\boldsymbol H$分别是1，2，3三个顶点的受力，另一个顶点4的受力为 $\boldsymbol f_{4} = - \boldsymbol f_{1} - \boldsymbol f_{2} - \boldsymbol f_{3}$ 。</p>
<p>&emsp;基于之上的讨论，一个可以用于计算四面体有限元弹性力的伪代码流程如下：</p>
<div align=center>

<p><img src= "/img/loading.gif" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/figure4.jpg" alt="tetrahedron">  </p>
</div>

<p>&emsp;对于三角形网格，其推导是类似的，只是少了一个维度。</p>
<h4 id="3-2-显式时间积分"><a href="#3-2-显式时间积分" class="headerlink" title="3.2 显式时间积分"></a>3.2 显式时间积分</h4><p>&emsp;基于上一节的讨论，已经得到了计算每个每个顶点上的受力。使用半隐式欧拉迭代方法更新点的位置和速度。</p>
<p>$$\boldsymbol v_{t+1,i} = \boldsymbol v_{t,i} + \Delta t \frac{\boldsymbol f_{t,i} }{m_{i}} \tag{18}$$</p>
<p>$$\boldsymbol x_{t+1,i} = \boldsymbol x_{t,i} + \Delta t  \boldsymbol v_{t+1,i}\tag{19}$$</p>
<h4 id="3-3-隐式时间积分"><a href="#3-3-隐式时间积分" class="headerlink" title="3.3 隐式时间积分"></a>3.3 隐式时间积分</h4><p>&emsp;隐式时间积分的更新迭代如下：</p>
<p>$$[\boldsymbol I - \Delta t^{2}\boldsymbol M ^{-1}\frac{\partial \boldsymbol f}{\partial \boldsymbol x}(\boldsymbol x_{t})]\boldsymbol v_{t+1} = \boldsymbol v_{t} + \Delta t \boldsymbol M^{-1}\boldsymbol f(\boldsymbol x_{t}) \tag{20}$$</p>
<p>这还需要计算力的导数 $\frac{\partial \boldsymbol f}{\partial \boldsymbol x}$, $-\frac{\partial \boldsymbol f}{\partial \boldsymbol x}$被称为stiffness matrix，在实际迭代求解中我们并不用真的构建这个矩阵，我们只需要知道它和某个向量 $ \boldsymbol w$ 的乘积结果即可进行迭代。下面的算法是力的微分$\delta \boldsymbol f = \frac{\partial \boldsymbol f}{\partial \boldsymbol x} \delta \boldsymbol x$的计算方式：</p>
<div align=center>

<p><img src= "/img/loading.gif" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/figure5.jpg" alt="tetrahedron">  </p>
</div>

<p><a target="_blank" rel="noopener" href="http://www.femdefo.org/">具体推导</a>。</p>
<h3 id="4、引用"><a href="#4、引用" class="headerlink" title="4、引用"></a>4、引用</h3><p>[1] E. Sifakis and J. Barbic (2012). “FEM simulation of 3D deformable solids: a practitioner’s guide to theory, discretization and model reduction”. In: Acm siggraph 2012 courses, pp. 1–50.</p>
<p>[2] C. Jiang et al. (2016). “The material point method for simulating continuum materials”. In: ACM SIGGRAPH 2016 Courses, pp. 1–52.</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">Tom</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://tomsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/">https://tomsworkspace.github.io/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://TOMsworkspace.github.io" target="_blank">Tom's develop Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E8%B6%85%E5%BC%B9%E6%80%A7%E7%89%A9%E4%BD%93/">超弹性物体</a><a class="post-meta__tags" href="/tags/%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/">有限元方法</a><a class="post-meta__tags" href="/tags/FEM/">FEM</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/弹性有限元方法/figure1.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏<div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/wp.jpg" target="_blank"><img class="post-qr-code-img" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/wp.jpg" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li></ul></div></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2021/09/27/%E6%B5%81%E4%BD%93%E6%A8%A1%E6%8B%9F%E4%B8%8ESPH%E6%96%B9%E6%B3%95/"><img class="prev-cover" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/27/流体模拟与SPH方法/figure1.jpg" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">流体模拟与SPH方法</div></div></a></div><div class="next-post pull-right"><a href="/2021/08/09/%E5%BC%B9%E7%B0%A7%E8%B4%A8%E7%82%B9%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86/"><img class="next-cover" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/09/弹簧质点系统与时间积分/figure1.png" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">弹簧质点系统与时间积分</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="gitalk-container"></div></div></div></div></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/avator.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">Tom</div><div class="author-info__description">keep curiously!</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">73</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">12</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/TOMsworkspace"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/TOMsworkspace" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:cqucscw@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="card-content"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E4%B8%8E%E8%B6%85%E5%BC%B9%E6%80%A7%E7%89%A9%E4%BD%93%E6%A8%A1%E6%8B%9F%E6%96%B9%E6%B3%95"><span class="toc-number">1.</span> <span class="toc-text">弹性有限元与超弹性物体模拟方法</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1%E3%80%81%E5%BD%A2%E5%8F%98%EF%BC%88Deformation%EF%BC%89"><span class="toc-number">1.1.</span> <span class="toc-text">1、形变（Deformation）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2%E3%80%81%E5%BC%B9%E6%80%A7%EF%BC%88Elasticity%EF%BC%89"><span class="toc-number">1.2.</span> <span class="toc-text">2、弹性（Elasticity）</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-1-%E5%BA%94%E5%8F%98%E5%8A%BF%E8%83%BD%EF%BC%88Strain-energy%EF%BC%89%E4%B8%8E%E5%BA%94%E5%8A%9B%EF%BC%88stress%EF%BC%89"><span class="toc-number">1.2.1.</span> <span class="toc-text">2.1 应变势能（Strain energy）与应力（stress）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-2-%E5%BC%B9%E6%80%A7%E6%A8%A1%E9%87%8F%EF%BC%88Elastic-moduli%EF%BC%89"><span class="toc-number">1.2.2.</span> <span class="toc-text">2.2 弹性模量（Elastic moduli）</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-3-%E8%B6%85%E5%BC%B9%E6%80%A7%E6%9D%90%E6%96%99%E6%A8%A1%E5%9E%8B"><span class="toc-number">1.2.3.</span> <span class="toc-text">2.3 超弹性材料模型</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3%E3%80%81%E7%BA%BF%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95%EF%BC%88Linear-finite-element-method"><span class="toc-number">1.3.</span> <span class="toc-text">3、线性有限元方法（Linear finite element method)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#3-1-%E5%9B%9B%E9%9D%A2%E4%BD%93%E6%9C%89%E9%99%90%E5%85%83%E4%B8%8E%E4%B8%89%E8%A7%92%E5%BD%A2%E6%9C%89%E9%99%90%E5%85%83"><span class="toc-number">1.3.1.</span> <span class="toc-text">3.1 四面体有限元与三角形有限元</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-2-%E6%98%BE%E5%BC%8F%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86"><span class="toc-number">1.3.2.</span> <span class="toc-text">3.2 显式时间积分</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-3-%E9%9A%90%E5%BC%8F%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86"><span class="toc-number">1.3.3.</span> <span class="toc-text">3.3 隐式时间积分</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4%E3%80%81%E5%BC%95%E7%94%A8"><span class="toc-number">1.4.</span> <span class="toc-text">4、引用</span></a></li></ol></li></ol></div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/09/27/%E6%B5%81%E4%BD%93%E6%A8%A1%E6%8B%9F%E4%B8%8ESPH%E6%96%B9%E6%B3%95/" title="流体模拟与SPH方法"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/27/流体模拟与SPH方法/figure1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="流体模拟与SPH方法"/></a><div class="content"><a class="title" href="/2021/09/27/%E6%B5%81%E4%BD%93%E6%A8%A1%E6%8B%9F%E4%B8%8ESPH%E6%96%B9%E6%B3%95/" title="流体模拟与SPH方法">流体模拟与SPH方法</a><time datetime="2021-09-27T08:46:17.000Z" title="发表于 2021-09-27 16:46:17">2021-09-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/" title="弹性有限元方法"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/弹性有限元方法/figure1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="弹性有限元方法"/></a><div class="content"><a class="title" href="/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/" title="弹性有限元方法">弹性有限元方法</a><time datetime="2021-09-11T09:05:34.000Z" title="发表于 2021-09-11 17:05:34">2021-09-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/08/09/%E5%BC%B9%E7%B0%A7%E8%B4%A8%E7%82%B9%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86/" title="弹簧质点系统与时间积分"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/09/弹簧质点系统与时间积分/figure1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="弹簧质点系统与时间积分"/></a><div class="content"><a class="title" href="/2021/08/09/%E5%BC%B9%E7%B0%A7%E8%B4%A8%E7%82%B9%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86/" title="弹簧质点系统与时间积分">弹簧质点系统与时间积分</a><time datetime="2021-08-09T13:39:12.000Z" title="发表于 2021-08-09 21:39:12">2021-08-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/08/08/OpenGL%E5%9D%90%E6%A0%87%E7%B3%BB%E7%BB%9F/" title="OpenGL坐标系统"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/08/OpenGL坐标系统/figure1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="OpenGL坐标系统"/></a><div class="content"><a class="title" href="/2021/08/08/OpenGL%E5%9D%90%E6%A0%87%E7%B3%BB%E7%BB%9F/" title="OpenGL坐标系统">OpenGL坐标系统</a><time datetime="2021-08-08T12:57:28.000Z" title="发表于 2021-08-08 20:57:28">2021-08-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/08/06/Doxygen%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E6%96%87%E6%A1%A3/" title="Doxygen自动生成文档"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/06/Doxygen自动生成文档/Doxygen.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Doxygen自动生成文档"/></a><div class="content"><a class="title" href="/2021/08/06/Doxygen%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E6%96%87%E6%A1%A3/" title="Doxygen自动生成文档">Doxygen自动生成文档</a><time datetime="2021-08-06T13:24:50.000Z" title="发表于 2021-08-06 21:24:50">2021-08-06</time></div></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2021 By Tom</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my <a href="https://TOMsworkspace.github.io/">blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button id="chat_btn" type="button" title="rightside.chat_btn"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    loader: {
      source: {
        '[tex]/amsCd': '[tex]/amscd'
      }
    },
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        addClass: [200,() => {
          document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
            const target = node.parentNode
            if (!target.classList.contains('has-jax')) {
              target.classList.add('mathjax-overflow')
            }
          })
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"><script src="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css"><script>$(function () {
  $('span.katex-display').wrap('<div class="katex-wrap"></div>')
})</script><script>function addGitalkSource () {
  const ele = document.createElement('link')
  ele.rel = 'stylesheet'
  ele.href= 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css'
  document.getElementsByTagName('head')[0].appendChild(ele)
}

function loadGitalk () {
  function initGitalk () {
    var gitalk = new Gitalk({
      clientID: 'e50742231659674c31e3',
      clientSecret: '59038139e289bc384e484d341205bbb95a123209',
      repo: 'TOMsworkspace.github.io',
      owner: 'TOMsworkspace',
      admin: ['TOMsworkspace'],
      id: '619ace6845c233487db8a7691aedfc9e',
      language: '-zh-CN# en, zh-CN, zh-TW, es-ES, fr, ru',
      perPage: 10,
      distractionFreeMode: false,
      pagerDirection: 'last',
      createIssueManually: true,
      updateCountCallback: commentCount
    })
    gitalk.render('gitalk-container')
  }

  if (typeof Gitalk === 'function') initGitalk()
  else {
    addGitalkSource()
    $.getScript('https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js', initGitalk)
  }
}

function commentCount(n){
  let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
  if (isCommentCount) {
    isCommentCount.innerHTML= n
  }
}

if ('Gitalk' === 'Gitalk' || !false) {
  if (false) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
  else loadGitalk()
} else {
  function loadOtherComment () {
    loadGitalk()
  }
}</script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js" async="async" mobile="false"></script><script>(function(){
  const bp = document.createElement('script');
  const curProtocol = window.location.protocol.split(':')[0];
  if (curProtocol === 'https'){
  bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  }
  else{
  bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  }
  bp.dataset.pjax = ''
  const s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(bp, s);
})()</script></div></body></html>